package com.gong;

import java.util.List;

import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.boot.autoconfigure.web.HttpMessageConverters;
import org.springframework.context.annotation.Bean;
import org.springframework.http.converter.HttpMessageConverter;
import org.springframework.web.servlet.config.annotation.WebMvcConfigurerAdapter;

import com.alibaba.fastjson.serializer.SerializerFeature;
import com.alibaba.fastjson.support.config.FastJsonConfig;
import com.alibaba.fastjson.support.spring.FastJsonHttpMessageConverter;
import com.fasterxml.jackson.databind.ser.std.SerializableSerializer;

/**
 * Hello world!
 *
 */
@SpringBootApplication
public class App extends WebMvcConfigurerAdapter
{
	public void configureMessageConverters(List<HttpMessageConverter<?>> converters){
		super.configureMessageConverters(converters);
    	FastJsonHttpMessageConverter fastConverter = new FastJsonHttpMessageConverter();
    	FastJsonConfig config = new FastJsonConfig();
    	
    	config.setSerializerFeatures(SerializerFeature.PrettyFormat);
    	fastConverter.setFastJsonConfig(config);

    	converters.add(fastConverter);
	}
    public static void main( String[] args )
    {
        System.out.println( "Hello 3" );
        SpringApplication.run(App.class, args);
    }
    
//    @Bean
//    public HttpMessageConverters fastJsonConverters(){
//    	FastJsonHttpMessageConverter fastConverter = new FastJsonHttpMessageConverter();
//    	FastJsonConfig config = new FastJsonConfig();
//    	
//    	config.setSerializerFeatures(SerializerFeature.PrettyFormat);
//    	fastConverter.setFastJsonConfig(config);
//    	HttpMessageConverter<?> converter = fastConverter;
//    	return new HttpMessageConverters(converter);
//    }
}
